-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Obsolete Microsoft.AspNetCore.HttpOverrides.IPNetwork #62490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I don't think this change should go through until dotnet/runtime#117114 is addressed. |
Yeah, thanks, that's why still makes it as draft |
@@ -83,7 +84,10 @@ public class ForwardedHeadersOptions | |||
/// <summary> | |||
/// Address ranges of known proxies to accept forwarded headers from. | |||
/// </summary> | |||
public IList<IPNetwork> KnownNetworks { get; } = new List<IPNetwork>() { new IPNetwork(IPAddress.Loopback, 8) }; | |||
public IList<IPNetwork> KnownNetworks { get; } = new List<IPNetwork>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change won't be necessary once the runtime is updated, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think so, will revert in later update
|
||
return true; | ||
} | ||
public static implicit operator IPNetwork(System.Net.IPNetwork ipNetwork) => new IPNetwork(ipNetwork); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? In general we try to stay away from implicit operators that allocate. What does this help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to improve the experience when using a System.Net.IPNetwork
, since it's going be removed, maybe the value is pretty low, let me remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is so users of ForwardedHeadersOptions.KnownNetworks
don't break when updating their apps.
Although, I think regardless this would be a binary breaking change because they'd still need to recompile to get the implicit operator? In which case, it's probably better to just not have the implicit operator and force them to use the new type.
|
||
namespace Microsoft.AspNetCore.HttpOverrides; | ||
|
||
public class IPNetworkTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's being used, even if obsoleted, we should continue to have tests for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will revert in later update
I agree we should obsolete Microsoft.AspNetCore.HttpOverrides.IPNetwork type to avoid confusion, but we may never actually delete it. I think we can keep any methods used convert from the old type to System.Net.IPNetwork for the purposes of backwards compatibility internal. It's not like HttpOverrides.IPNetwork was an exchange type, and it's very similar to the new type, so it should be pretty easy to migrate code to use a new System.Net.IPNetwork-property without needing us to provide public conversion methods. The big question is what to name the new System.Net-based version of the How does |
Obsolete Microsoft.AspNetCore.HttpOverrides.IPNetwork
Obsolete
Microsoft.AspNetCore.HttpOverrides.IPNetwork
to preferSystem.Net.IPNetwork
Description
Mark
Microsoft.AspNetCore.HttpOverrides.IPNetwork
as obsolete, and preferSystem.Net.IPNetwork
fixes #46157